package hongcaosp.app.android.video.record;

import android.content.Context;

import com.tencent.liteav.demo.ugccommon.TCVideoEditerMgr;
import com.tencent.liteav.demo.ugccommon.TCVideoFileInfo;

import java.util.ArrayList;

import xlj.lib.android.base.component.BasePresenter;
import xlj.lib.android.base.utils.TaskPool;

public class SelectVideoPresenter extends BasePresenter {

    private SearchVideoCallBack searchVideoCallBack;

    public SelectVideoPresenter(SearchVideoCallBack searchVideoCallBack) {
        this.searchVideoCallBack = searchVideoCallBack;
    }

    public void fresh(final Context context) {
        TaskPool.myPool().post(new TaskPool.AsyncRunnable<ArrayList<TCVideoFileInfo>>() {
            @Override
            public void postForeground(ArrayList<TCVideoFileInfo> result) {
                searchVideoCallBack.onGetVideos(result);
            }

            @Override
            public ArrayList<TCVideoFileInfo> run() {
                return TCVideoEditerMgr.getAllVideo(context);
            }
        });

    }

    public interface SearchVideoCallBack {
        void onGetVideos(ArrayList<TCVideoFileInfo> result);
    }
}
